package Stack;


public class CommonStack {

	final static int SIZE = 50;
	static Object[] stack = null;
	static int pointer = 0;
	
	CommonStack(){
		this(SIZE);
	}
	
	CommonStack(int size){
		stack = new Object[size];	
	}
	
	String push(int i){
		if (pointer < stack.length) {
			stack[pointer++] = i;
			return "OK";
		} else {
			return "bomb";
		}
	}
	
	String pop(){
		if (pointer >= 0) {
			stack[--pointer] = 0;
			return "OK";
		}else {
			return "ERROR";
		}
	}

	void out(){
		for (int i = 0; i < stack.length; i++) {
			System.err.print(stack[i]+" ");
		}
		System.err.println();
	}
}
